home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-11-19 | 1.5 KB | 67 lines | [TEXT/MPS ] |
- !!G toolbox.finc
- !!MP inlines.f
-
- C This program creates an array of all the file names in the folder
- C of the selected file.
- C
- c Example provided for owners of Language Systems FORTRAN
- c © 1990 Language Systems Corp.
-
- Integer*4 NewVRefNum, filecount
- Character*30 filelist(300)
-
- open(1,file=*, status = 'old') !User selects any file in the folder
- NewVRefNum = JVREFNUM(1)
- close(1)
- Call GetFiles(NewVRefNum, filelist, filecount)
- Do I = 1,filecount
- !open(1,file=filelist(i), status= 'old')
- ! do whatever you want
- !close(1)
- write(*,*) filelist(i)
- End Do
- end
-
- Subroutine GetFiles(Vrefnum,list,count)
- Integer*4 VRefNum, count
- Integer*2 idx
- Character*30 list(*)
- String*255 fname
- Character*255 tempname
- Record /HParamBlockRec/ HPB
- count = 0
- ioserr = noerr
- idx = 1
- Do While (ioserr = noerr)
- HPB.ioCompletion = nil
- HPB.ionamePtr = %loc(fname)
- HPB.ioVRefNum = Vrefnum
- HPB.ioFVersNum = 0
- HPB.ioFDirIndex = idx
- ioserr = PBGetFInfo(%ref(HPB),INT2(0))
- if (ioserr = noerr) then
- tempname = fname
- Call UpperCase(tempname)
- fname = tempname
- !Test fname for the extension you want, or proper length, etc.
- !If it meets your criteria, then
- count = count + 1
- list(count) = fname
- !In any case,
- idx = idx + 1
- end if
- End Do
- return
- end
-
- Subroutine UpperCase(thestring)
- Character*(*) thestring
- Do I = 1,Len(thestring)
- j = ICHAR(thestring(i:i))
- if ((j .GE. 97) .AND. (j .LE. 122)) then !Is j a lower case letter?
- thestring(i:i) = CHAR(j-32)
- end if
- End Do
- return
- end
-